# 初始化文件，创建flask应用

# 导入flask对象
from flask import Flask
# from .views import blue
from .views import *
from .exts import init_exts


# 创建flask应用对象
def creat_app():
    app = Flask(__name__)

    # 注册蓝图
    app.register_blueprint(blueprint=blue)

    # 配置数据库
    # db_uri = 'sqlite:///sqlite3.db'  # sqlite配置
    db_uri = 'mysql+pymysql://root:123456@localhost:3306/design'  # mysql配置
    app.config['SQLALCHEMY_DATABASE_URI'] = db_uri
    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False  # 禁止对象追踪修改

    # 初始化插件
    init_exts(app=app)

    return app
